package com.test.qnews.activity;


import android.view.View;
import android.widget.ExpandableListView;

import com.test.qnews.R;
import com.test.qnews.adapter.WeatherAdapter;
import com.test.qnews.custom.IndexView;

/**
 * Created by dllo on 16/1/19.
 */
public class WeatherActivity extends BaseActivity {
    private ExpandableListView expandableListView;
    private WeatherAdapter weatherAdapter;
    private IndexView indexView;

    @Override
    protected int setLayout() {
        return R.layout.exlistview_weather;
    }

    @Override
    protected void initView() {

        expandableListView = (ExpandableListView) findViewById(R.id.ex_listview);
        weatherAdapter = new WeatherAdapter(this);
        expandableListView.setAdapter(weatherAdapter);
        indexView = (IndexView) findViewById(R.id.index);
        indexView.setmListView(expandableListView);


        int groupCount = expandableListView.getCount();
        for (int i = 0; i < groupCount; i++) {
            expandableListView.expandGroup(i);
        }

        expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
            @Override
            public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
                return true;
            }
        });
    }
}
